package com.nstar.carousel.base
{
	import com.nstar.base.event.AdvanceEvent;
	import com.nstar.carousel.components.*;
	import com.nstar.carousel.model.ProductVO;
	
	import flash.events.MouseEvent;
	
	import mx.containers.ViewStack;
	import mx.effects.Effect;
	import mx.events.FlexEvent;	


	public class ImageStageBaseClass extends ViewStack
	{
		private var _dataProvider:Array ;
		
		private var _effect:Effect;//切换效果
		private var _direction:String ="left";//效果显示的方向
				
		public function ImageStageBaseClass()
		{
			super();
			this.addEventListener(FlexEvent.CREATION_COMPLETE,init);
		}
		
		private function init(event:FlexEvent):void{
			
		}
		//显示详情
		public function showDetails(product:ProductVO,w:Number=800,h:Number=500):void{
			ProductDetail.show(product,w,h);
		}		
		//设置数据源
		public function set dataProvider(value:Array):void{
			this._dataProvider = value;
			//创建子项
			createChildrenItem();
			//子类实现布局
			layout();
		}
		
		public function priorHandler(event:MouseEvent):void{
			this.dispatchEvent(new AdvanceEvent(CarouselBaseClass.PRIOR));;
		}
		
		public function nextHandler(event:MouseEvent):void{
			this.dispatchEvent(new AdvanceEvent(CarouselBaseClass.NEXT));
		}		
		
		public function get dataProvider():Array{
			return this._dataProvider;
		}
		
		public function set effect(value:Effect):void{
			this._effect = value;
		}
		
		public function get effect():Effect{
			return this._effect;
		}
		
		public function set direction(value:String):void{
			this._direction = value;
		}
		
		public function get direction():String{
			return this._direction;
		}		
		
		public function createChildrenItem():void{
			throw new Error("请在子类中实现createChildrenItem()方法！");
		}
		
		public function layout():void{
			throw new Error("请在子类中实现layout()方法！");
		}		
		
	}
}